verify_signature

(alias) function verify_signature(data_hash: byte_array, pubkey: byte_array, signature: byte_array): boolean

Verify a signature against a message and public key.

More precisely, verify that signature was obtained with a procedure equivalent to get_signature(data_hash, privkey), where privkey and pubkey form a keypair.

Accepts valid public keys of size 33 or 65 bytes. Note that not all byte arrays of acceptable length constitute valid public keys.

Alias

Return

true if the signature is valid, indicating that the message was indeed signed by the private key belonging to the keypair of the given public key; false otherwise

Since

0.10.6

Parameters

data_hash

the original (unsigned) 32-byte array

pubkey

the public key (33, 64 or 65 bytes)

signature

the 64-byte signature to verify

Throws

exception

when:

  • data_hash does not have length 32

  • signature does not have length 64

  • pubkey does not have length 33 or 65

  • pubkey is not a valid public key